from PyQt5.QtCore import QUrl

from com.common.BaseModel import BaseModel, xpath
from com.common import anno
from com.common.anno import TargetUrl, HelpUrl, sched, TimeUtil


@HelpUrl(xpath='//a[contains(text(), "下一页")]//@href')
@TargetUrl(xpath=".//ul[@class='list']//a/@href")
@sched(schedNum=3,timeUtil=TimeUtil.secend)
class swxw(BaseModel):
    BaseModel.sleepTime = 3
    def __init__(self):
        self.title = xpath('//title/text()')
        self.content = xpath('//div[@id="fontzoom"]//text()')
        self.pubtime = xpath('.//div[@class="share_l"]/span[1]/text()')
        self.source = xpath('.//span[@class="laiyuan1"]/a/text()')

swxw()\
    .urls("http://www.chinatax.gov.cn/chinatax/manuscriptList/n810724?_channelName=%E7%A8%8E%E5%8A%A1%E6%96%B0%E9%97%BB&_isAgg=0&_pageSize=20&_template=index")\
    .run()

